New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: updated baseHRefRegex to perform lazy match #9724
Conversation
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #9724 +/- ##
=======================================
Coverage 45.78% 45.79%
=======================================
Files 226 226
Lines 26714 26715 +1
=======================================
+ Hits 12232 12233 +1
Misses 12818 12818
Partials 1664 1664
Continue to review full report at Codecov.
|
@@ -132,7 +132,7 @@ var backoff = wait.Backoff{ | |||
|
|||
var ( | |||
clientConstraint = fmt.Sprintf(">= %s", common.MinClientVersion) | |||
baseHRefRegex = regexp.MustCompile(`<base href="(.*)">`) | |||
baseHRefRegex = regexp.MustCompile(`<base href="(.*?)">`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a test as well? I would suggest moving the line below into function and add a unit test for it
Line 896 in a67b97d
s.indexData = []byte(baseHRefRegex.ReplaceAllString(string(data), fmt.Sprintf(`<base href="/%s/">`, strings.Trim(s.BaseHRef, "/")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added unit test
I think this is a regression, so adding cherry-pick label cc @crenshaw-dev , @leoluz |
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
* fix: updated baseHRefRegex to perform lazy match Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com> * feat: added unit tests for replaceBaseHRef Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Alex cherry-picked onto 2.4 for release with 2.4.2. |
Signed-off-by: Soumya Ghosh Dastidar gdsoumya@gmail.com
Fixes #9660
Fixes #9692
This PR fixes the baseHRefRegex to perform a lazy match preventing index.html from being broken
After change resulting index.html (--rootpath=/argocd):
Checklist: